home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 128 22
/
q22.d81
/
t.slide poker
< prev
next >
Wrap
Text File
|
2022-08-28
|
16KB
|
331 lines
SLIDE POKER 128 AND CONTROL80-C V1.1
by Jon Mattson
(SLIDE POKER is based on a game by Maurice Jones and Fender Tucker)
Some time ago, while I was working on an 80-column Crazy Eights game
for LS128, I decided to design a few standard routines that would simplify
the creation of card games in general. My first priority was to have
large, crisp cards which would, nevertheless, be drawn quickly on the
screen. I also wanted the shuffle routine to be virtually instantaneous
and the whole package to work with Control80, since I never program on the
80-column screen without that utility, these days. (Fender says much the
same. All modesty aside, if you are a C128 programmer working with the 80-
column screen you may want to try it out, too: it makes life much simpler.
Plug, plug...) It soon became clear that what I really needed to do was
create a new version of Control80, specifically designed for card games,
and that is exactly what I did.
After the game was published, Fender took a look at the code and grew
curious about the previously unseen keywords contained therein, so I filled
him in on the new version of Control80, C80-C. He realized, showing more
foresight than I'm afraid I had displayed, that a lot of other people might
find it handy if they knew how to use it, so he asked me to come up with
another card game, specifically designed to showcase C80-C. I was a bit
stumped at first, because I wanted to do a card game unlike anything which
had previously appeared on LS 128. Fender soon came to the rescue again,
though: he and Maurice Jones had recently finished a game for the C-64
which he thought could be ported over to LS 128 with good effect. Thus was
born SLIDE POKER 128.
There is really little more to be said about the game, since you can
read all about it from within the program itself, simply by pressing 'R'.
This is listed on the main screen, so you don't even have to remember that.
The rest of this article will be devoted, instead, to C80-C and how you can
make use of it. Much of the following information will be familiar to
those who have used Control80 before; however, it has been repeated here
for those who have not. Even veteran users should look this over and take
note: for reasons of space, this run-time version does not include five of
the old commands, namely DUMP, HOME, LCLEAR, VSAVE and MINE. On the other
hand, three new commands -- CARD, DICE and SHUF -- have been added, and
FILL has been improved. Also note that this version of C80-C (V1.1)
supersedes the version which accompanied CRAZY EIGHTS (V1.0), since it
improves upon the latter by adding Jokers to the deck.
First of all, a quick overview is in order for those who have no idea
what Control80 and its close cousin, C80-C, are all about. Control80 is an
extension of the BASIC 7.0 which adds many new keywords to the language.
These new functions and commands are specifically designed to make using
the 80-column screen easier. Those who have tried to work with 80-columns
in BASIC 7.0 will realize just what a boon this is: you can't even PEEK or
POKE to the VDC with normal BASIC! Control80 solves that problem and many
others, as well.
Using C80-C is simple. First, set aside a section of memory to hold
it by opening up the area normally used for hires graphics. GRAPHIC1,1
will accomplish this, although it should be followed by GRAPHIC0,1 to get
out of hires mode and GRAPHIC5 to return the screen editor controls to the
80-column screen. Then, just BLOAD C80-C into memory and SYS 4864, either
in direct mode or early on in your program. Generally a simple BLOAD will
suffice, but, if you have been playing around with BANKs and the like, you
might want to use the full syntax. To summarize:
GRAPHIC1,1:GRPAHIC0,1:GRAPHIC5:BLOAD"C80-C",B0,P4864:SYS4864
Unlike Control80, C80-C comes with a built-in, card-oriented font,
which can be moved to VDC memory with a simply FCOPY 6880,0,1. This
command will cause the new font to replace the existing alternate
(upper/lower case) font, so that you can use the CARD command. Once the
font is in place, you can freely overwrite the area it previously occupied
and even 'collapse' the graphic area with GRAPHICCLR to free up more
program space if you wish, since C80-C, itself, resides below this area.
As an aside, this is why you must open a graphics area for C80-C, whereas
you do not need to do so with Control80. For obvious reasons, the FCOPY
should come very shortly after the set-up commands previously mentioned;
however, it should not be on the same line as those commands. The reason
for this is that the computer deciphers keywords a line at a time, and,
until the SYS 4864 has actually been acted upon, the FCOPY command will be
translated as gibberish, resulting in a syntax error when that point in the
line is reached.
Once C80-C is installed, the new keywords can be used just like any
other BASIC commands. You can even abbreviate them by shifting the second
letter, as usual. Remember that C80-C must be active (not just resident)
while you type in a program using its keywords, or they will not be
tokenized correctly. Note, also, that C80-C uses memory from 4864 to 6879
(once the font has been moved), so avoid POKEing around this area.
Hitting the beloved STOP/RESTORE combination will not deactivate C80-
C. The QUIT command (previously unimplemented on the 128) will turn it
off, although SYS 4864 will bring it back to life. Resetting the computer
will also turn it off; however, due to its location, C80-C will still be
resident for later use, as long as you haven't POKEd over its memory space.
In this case, however, the font will likely be lost.
Now let's look at your new resources. Certain conventions have been
followed in this listing. Memory addresses are 0-65535, as usual, to allow
use with both 16K and 64K VDCs. Note, however, that addresses above 16383
wrap around on the 16K chip, i.e. 16384 = 0. Remember that the basic 8563
chip is set up as follows:
$0000 - 07FF 0 - 2047 Screen
$0800 - 0FFF 2048 - 4095 Attributes
$1000 - 1FFF 4096 - 8191 Unused
$2000 - 2FFF 8192 - 12287 Upper Case/Graphic (normal) Font
$3000 - 3FFF 12288 - 16383 Upper/Lower Case (alternate) Font
VDC register numbers (reg# below) range from 0-36. It is not within
the scope of this article to explain the use of every register, but a
simplified listing is given in the previous Control80 article, and a
complete description can be found in the C-128 Programmer's Reference
Guide. When in doubt, experiment with the WVD command, but be sure that
you check the register's normal value first with the RVD function to set
things back to normal!
*** FUNCTIONS ***
PEER (VDC address)
This function allows you to check the contents of VDC memory. It
operates just like BASIC's PEEK. For example, to find the character in the
top left corner of the screen, PRINT PEER(0). Note that PEER is the
counterpart of POST, below.
RVD (reg#)
This function (Read ViDeo register) allows you to check the contents
of any of the 37 VDC registers. For example, A=RVD(12) would put the
contents of register 12 into the variable A. Note that RVD is the
counterpart of WVD, below.
*** COMMANDS ***
BLOCK VDC address, number, value
This command allows you to fill any small section of VDC memory with a
single value. "Address" indicates the starting position of the fill, and
"number" (2-255) indicates how many consecutive locations to fill with the
specified "value" (0-255), from that point on. One of the best uses of
BLOCK is to highlight a line on the screen by filling attribute memory with
a different color value and/or reverse. For example, BLOCK 2048,80,72
would highlight the entire first line of the screen by coloring it red and
using reverse characters. See FILL for more information on attribute
memory.
CARD top